<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .parent{
            width: 400px;
            height: 400px;
            background-color: red;
            /* 相对定位 */
            position: relative;
        }
        .son{
            width: 80px;
            height: 80px;
            background-color: yellow;
            /* 绝对定位 */
            /* position: absolute; */
            /* 相对定位 */
            /* 定位居中 */
            position: relative;
            left: 200px;
            top: 200px;
            transform: translate(-50%,-50%);
            
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="son"></div>
    </div>
</body>
</html>